class Solution {
public:
    bool isSymmetric(TreeNode* root){ 
        if(!root) return true;
        else return isSymmetric(root->left, root->right);
    }
    bool isSymmetric(TreeNode* left, TreeNode* right){
        if(!left && !right) return true;
        else if(!left || !right || left->val != right->val) return false;
        return isSymmetric(left->left, right->right) && isSymmetric(left->right, right->left);      
    }
};